<style type="text/css">
    *{
        font-size:14px!important;
    }
    .form-group{
        height: 40px;
        width: 90%;
        margin: 0 auto;
        margin-bottom: 15px;
        border-bottom:1px solid #A0A0A0;
        position: relative;
    }
    .real-container{
        width: 90%;
        margin: 0 auto;
    }
    .form-group input{
        width: 100%;
        height: 100%;
        padding-left: 15px;
        background: transparent;
        color: #fff;
    }
    .verifyCodeBtn{
        position: absolute;
        right: 6%;
        top: 0;
    }
    .yzm-container .form-group input{
        width: 70%;
    }
    .yzm-container{
        position: relative;
    }
    .form-group.field-user-pid{
        display: none;
    }
    .real-ready{
        white-space: nowrap;
    }
    .my-btns.login-btn{
        width: 70%;
        margin: 40px auto;
        background: #e6262e;
        padding: 8px 0px;
        font-size: 1.2em;
        color: #fff;
        border-radius: 25px;
        text-align: center;
        font-size: 16px;
        display: block;
    }
    .form-group input::-webkit-input-placeholder{
        color: #aaa;
    }
    .verifyCodeBtn {
        position: absolute;
        right: 6%;
        top: 0;
        color: red;
    }
</style>
<?php common\components\View::regCss('login.css') ?>

<div class="main">
    <div style="" class="header">
         <a href="javascript:history.go(-1)"> <i class="iconfont">&#xf0292;</i></a>
         注册
       </div>
<?php $form = self::beginForm(['showLabel' => false, 'class' => 'my-form registerForm']) ?>
        <?= $form->field($model, 'mobile')->textInput(['placeholder' => '手机号', 'class' => 'phone-num-inp user-mobile'])  ?>
        <?= $form->field($model, 'nickname')->textInput(['placeholder' => '请填写昵称', 'class' =>''])  ?>

        <?= $form->field($model, 'password')->passwordInput(['placeholder' => '请输入您的密码', 'class' => 'pwd-input'])  ?>
        <?= $form->field($model, 'cfmPassword')->passwordInput(['placeholder' => '确认的密码', 'class' => 'pwd-input confirm-pwd'])  ?>
        <div class="yzm-container">
        <?= $form->field($model, 'verifyCode')->textInput(['placeholder' => '手机验证码', 'class' => 'pwd-input yzm'])  ?>
            <span class="verifyCodeBtn" data-action="<?= url(['site/verifyCode']) ?>">获取验证码</span>
        </div>
        <?= $form->field($model, 'code')->textInput(['placeholder' => '代理商邀请码', 'class' => 'pwd-input yzm'])  ?>
        

        <input class="my-btns login-btn" type="button" value="立即注册"/>
<?php self::endForm() ?>
</div>

<script>
$(function () {
    $(".login-btn").click(function () {
        $("form").ajaxSubmit($.config('ajaxSubmit', {
            success: function (msg) {
                if (!msg.state) {
                    $.alert(msg.info);
                } else {
                    window.location.href = msg.info;
                }
            }
        }));
        return false;
    });
    // 验证码
    $(".verifyCodeBtn").click(function () {
        var mobile = $('.user-mobile').val();
        var url = $(this).data('action');
        if (mobile.length != 11) {
            $.alert('您输入的不是一个手机号！');
            return false;
        }
        $.post(url, {mobile: mobile}, function(msg) {
              $.alert(msg.info);
        }, 'json');
    });

    $('.sex').click(function(){
        $(this).addClass('in-aput-xz').siblings('.sex').removeClass('in-aput-xz');
    })
});
</script>